package cn.yto.print.enums;

import cn.yto.print.service.impl.*;
import lombok.Getter;

@Getter
public enum PluginRegistryEnum {

    /* 打印组件注册表键枚举 */
    CN("cainiao", "菜鸟", "13528", "菜鸟打印组件", "DisplayIcon", "CNPrintClient.exe", CaiNiaoMessageHandler.class, "print.plugin.cainiao"),
    DY("tiktok", "抖音", "13888", "{2593AD82-7B06-4EF8-8BCB-2736817DE0EB}_is1", "Inno Setup: App Path", "CloudPrintClient.exe", TikTokMessageHandler.class, "print.plugin.tiktok"),
    WPH("wph", "唯品会", "12233", "1794d5d7-523e-5dfd-863b-99c25a7852da", "DisplayIcon", "vip_print.exe", WphMessageHandler.class, "print.plugin.wph"),
    PDD("pdd", "拼多多", "5000", "拼多多打印组件", "DisplayIcon", "PDDPrintClient.exe", PddMessageHandler.class, "print.plugin.pdd"),
    DW("dewu", "得物", "23825", "e4a6ca5a-2995-5f7b-bd3e-619a0220fae9", "DisplayIcon", "得物打印.exe", DeWuMessageHandler.class, "print.plugin.dewu"),
    JD("jd", "京东", "9113", "{0CC4FA9D-BD67-4F74-AC55-04F7E02CC539}_is1", "DisplayIcon", "JD打印组件.exe", JingDongMessageHandler.class, "print.plugin.jd"),
    XHSX("xiaohongshux", "新版小红书", "10818", "小红书打印组件", "DisplayIcon", "小红书打印组件.exe", XhsnMessageHandler.class, "print.plugin.xiaohongshux"),
    KS("kuaishou", "快手", "16888/ks/printer", "{707228D3-ABCA-43E3-A833-511C4C9E48BF}_is1", "Inno Setup: App Path", "kuaishou-print.exe", KuaiShouMessageHandler.class, "print.plugin.kuaishou"),
    WXSPH("wxsph", "微信视频号", "12705", "796bf78f-aba6-5a5f-b366-03d84a5d4b15", "DisplayIcon", "WeChatShopPrintClient.exe", WxsphMessageHandler.class, "print.plugin.wxsph"),
    AKC("aikucun", "爱库存", "2750", "梦饷官方打印组件", "InstallLocation", "MXPrintClient.exe", AiKuCunMessageHandler.class, "print.plugin.aikucun");

    private final String code;
    private final String name;
    private final String portUrl;
    private final String registryPath;
    private final String startUpPathKey;
    private final String processes;
    private final Class<?> beanClass;
    private final String locale;

    PluginRegistryEnum(String code, String name, String portUrl, String registryPath, String startUpPathKey, String processes, Class beanClass, String locale) {
        this.code = code;
        this.name = name;
        this.portUrl = portUrl;
        this.registryPath = registryPath;
        this.startUpPathKey = startUpPathKey;
        this.processes = processes;
        this.beanClass = beanClass;
        this.locale = locale;
    }

    public static PluginRegistryEnum getPluginByCode(String code) {
        for (PluginRegistryEnum pluginRegistry : PluginRegistryEnum.values()) {
            if (pluginRegistry.code.equalsIgnoreCase(code)) {
                return pluginRegistry;
            }
        }
        return null;
    }

    public static PluginRegistryEnum getPluginByProcesses(String processes) {
        for (PluginRegistryEnum pluginRegistry : PluginRegistryEnum.values()) {
            if (pluginRegistry.processes.equalsIgnoreCase(processes)) {
                return pluginRegistry;
            }
        }
        return null;
    }

}
